package com.hhkj.admin.sale.common.cont;

import com.ruoyi.common.exception.GlobalException;
import lombok.AllArgsConstructor;
import lombok.Getter;

public class SaleWithdrawalConst {

    public static final String EXPORT_EXCEL_TITLE = "提现明细数据汇总";

    @AllArgsConstructor
    @Getter
    public enum StatusCode {

        NORMAL("正常", "normal"),

        EXCEPTION("异常", "exception");

        private final String name;

        private final String code;

        public static String getNameByCode(String code) {
            for (StatusCode value : StatusCode.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            throw new GlobalException("找不到对应的code，请联系管理员");
        }
    }

    @AllArgsConstructor
    @Getter
    public enum AccountTypeCode {

        ALIPAY("支付宝", "alipay");

        private final String name;

        private final String code;

        public static String getNameByCode(String code) {
            for (AccountTypeCode value : AccountTypeCode.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
           throw new GlobalException("找不到对应的code，请联系管理员");
        }
    }

    @AllArgsConstructor
    @Getter
    public enum CompleteFlag {

        COMPLETE("到账", 1),

        UN_COMPLETE("未到账", 0);

        private final String name;

        private final Integer code;

        public static String getNameByCode(Integer code) {
            for (CompleteFlag value : CompleteFlag.values()) {
                if (value.code.equals(code)) {
                    return value.name;
                }
            }
            throw new GlobalException("找不到对应的code，请联系管理员");
        }
    }


}
